<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // test()
    function test() {
        var a =
            '<img src="../res/img/emotion/Expression_5.png" border="0" width="25"><img src="../res/img/emotion/Expression_2.png" border="0" width="25"><img src="../res/img/emotion/Expression_4.png" border="0" width="25"><img src="../res/img/emotion/Expression_4.png" border="0" width="25"><img src="../res/img/emotion/Expression_6.png" border="0" width="25"><img src="../res/img/emotion/Expression_6.png" border="0" width="25">123514545<img src="../res/img/emotion/Expression_19.png" border="0" width="25"><img src="../res/img/emotion/Expression_18.png" border="0" width="25"><img src="../res/img/emotion/Expression_19.png" border="0" width="25">';
        var imgReg = /<img.*?(?:>|\/>)/gi; //匹配图片中的img标签
        var srcReg = /src=[\'\"]?([^\'\"]*)[\'\"]?/i; // 匹配图片中的src
        var str = a;
        var arr = str.match(imgReg) //筛选出所有的img
        var srcArr = []
        for (var i = 0; i < arr.length; i++) {
            var src = arr[i].match(srcReg);
            src = src[1];
            src = src.replace('../res/img/emotion/', '');
            src = src.replace('.png', '');
            // 获取图片地址
            srcArr.push(src);
        }
        _log(srcArr)
    }
    test2();

    function test2() {
        var a = 'aaabbbcaaa';
        var reg = new RegExp('a', 'gi');
        var b = a.replace(reg, '1');
        _log(b);
    }
</script>

</html>